<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <h1 id="hiem"></h1>
    <h1 id="hiem1"></h1>
</body>
<script>
    // 1.距离春节1月31日倒计时几天几分几秒动态显示
    function fun() {
        var atrs = ""
	var EndTime = new Date("2022/01/1 00:00:00")
	var NowTime = new Date()
	 t = EndTime.getTime() - NowTime.getTime()
	 d = Math.floor(t / 1000 / 60 / 60 / 24)
	 h = Math.floor(t / 1000 / 60 / 60 % 24)
	 m = Math.floor(t / 1000 / 60 % 60)
	 s = Math.floor(t / 1000 % 60)
        atrs+=`距离元旦假期还有${d}天${h}小时${m}分钟${s}秒，兄弟们Holder住，我们能赢` 
    hiem.innerHTML=atrs
}
setInterval(fun, 1000);



function getRTime() {
        var str = ""
	var EndTime = new Date("2022/01/15 00:00:00")
	var NowTime = new Date()
	 t = EndTime.getTime() - NowTime.getTime()
	 d = Math.floor(t / 1000 / 60 / 60 / 24)
	 h = Math.floor(t / 1000 / 60 / 60 % 24)
	 m = Math.floor(t / 1000 / 60 % 60)
	 s = Math.floor(t / 1000 % 60)
        str+=`距离春节假期还有${d}天${h}小时${m}分钟${s}秒，兄弟们Holder住，我们能赢` 
    hiem1.innerHTML=str
}
setInterval(getRTime, 1000);


// 2.将字符串最后一个字符保留，前面所有的替换成*
// var str = "hueb fiqwoo bhfuyu  ejwnkkh njiwlg nuiln ppppppppppppp",
//     str1 = str.replace(/.(?=.)/g,"*")
// console.log(str1);


// 3.将一个字符串以T开头至M结尾的的部分替换成~
// var str = "hueb fiqwoo T bhfuyu  ejwnkkh M njiwlg nuiln ppppppppppppp",
//     str1 = str.replace(/T(.*)nM/,"*")
//     console.log(str1);






</script>
</html>